﻿using MoonSharp.Interpreter;
using MoonSharp.Interpreter.Loaders;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MoonSharpDemo
{
    class Program
    {
        static void Main(string[] args)
        {
            Script script = new Script();
            ((ScriptLoaderBase)script.Options.ScriptLoader).ModulePaths = new string[] { Path.GetFullPath("../..")+ "/script/?", Path.GetFullPath("../..")+ "/script/?.lua" };
            String lua = @"require('npc')
                           require('gate')
                           return npc.randomstring(10),gate.sum(5, 8)";
            DynValue ret = script.DoString(lua);
            Console.WriteLine("dostring {0} = {1};{2} = {3}", ret.Tuple[0].Type, ret.Tuple[0], ret.Tuple[1].Type, ret.Tuple[1]);
            ret = script.DoFile(Path.GetFullPath("../..") + "/script/main.lua");
            Console.WriteLine("dofile {0} = {1};{2} = {3}", ret.Tuple[0].Type, ret.Tuple[0], ret.Tuple[1].Type, ret.Tuple[1]);
            Console.ReadKey(true);
        }
    }
}
